package 华为OD机试真题2023.基础题;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.*;

public class Test {
  public static void main(String[] args) throws FileNotFoundException {
    Scanner in = new Scanner(new File("src/main/java/华为OD机试真题2023/基础题/input/test.txt"));
    String s = in.nextLine();
    String rule = "aAzZbByYcCxXdDwWeEvVgGuUhHtTiIsSjJrRkKqQlLpPmMoOnN";
    char[] sArray = s.toCharArray();
    Character[] ssArray = new Character[sArray.length];
    for (int i = 0; i < sArray.length; i++) {
      ssArray[i] = sArray[i];
    }
    Arrays.sort(
        ssArray,
        (a, b) -> {
          return rule.indexOf(a) - rule.indexOf(b);
        });
    StringBuilder res1 = new StringBuilder();
    StringBuilder res2 = new StringBuilder();
    for (int i = 0; i < ssArray.length; i++) {
      if (Character.isDigit(ssArray[i])) {
        res2.append(ssArray[i]);
      } else {
        res1.append(ssArray[i]);
      }
    }
    System.out.println(res1.append(res2));
  }
}
